var t = require;
var e = module;
var o = exports;
var _n6,
    i =
        (this && this.__extends) ||
        ((_n6 = function n(t, e) {
            return (_n6 =
                Object.setPrototypeOf ||
                ({__proto__: []} instanceof Array &&
                    function (t, e) {
                        t.__proto__ = e;
                    }) ||
                function (t, e) {
                    for (var o in e) {
                        Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
                    }
                })(t, e);
        }),
        function (t, e) {
            function o() {
                this.constructor = t;
            }
            _n6(t, e), (t.prototype = null === e ? Object.create(e) : ((o.prototype = e.prototype), new o()));
        }),
    s =
        (this && this.__decorate) ||
        function (t, e, o, n) {
            var i,
                s = arguments.length,
                r = s < 3 ? e : null === n ? (n = Object.getOwnPropertyDescriptor(e, o)) : n;
            if (
                "object" == (typeof Reflect === "undefined" ? "undefined" : typeof Reflect) &&
                "function" == typeof Reflect.decorate
            )
                r = Reflect.decorate(t, e, o, n);
            else
                for (var c = t.length - 1; c >= 0; c--) {
                    (i = t[c]) && (r = (s < 3 ? i(r) : s > 3 ? i(e, o, r) : i(e, o)) || r);
                }
            return s > 3 && r && Object.defineProperty(e, o, r), r;
        };
Object.defineProperty(o, "__esModule", {value: !0});
var r = cc._decorator,
    c = r.ccclass,
    a = r.property,
    u = t("Global"),
    l = t("BaseUI"),
    d = t("UIEnum"),
    p = t("UIManager"),
    h = t("SDK"),
    f = (function (t) {
        function e() {
            var e = (null !== t && t.apply(this, arguments)) || this;
            return (
                (e.childNode = null),
                (e.shareBtn = null),
                (e.videoBtn = null),
                (e.closeBtn = null),
                (e.btnsNode = null),
                (e.game = null),
                e
            );
        }
        return (
            i(e, t),
            (e.prototype.onLoad = function () {
                var t = this,
                    e = this;
                this.shareBtn.on(
                    cc.Node.EventType.TOUCH_END,
                    function (t) {
                        h.default.shareRecorder({
                            success: function success() {
                                u.default.shareVideoCount++,
                                    (u.default.shareVideo = !0),
                                    e.game && (e.game.fuhuo(), e.game.sendEvent("shareFuhuo")),
                                    e.hide();
                            },
                            query: ""
                        }),
                            t.stopPropagation();
                    },
                    this
                ),
                    this.videoBtn.on(
                        cc.Node.EventType.TOUCH_END,
                        function (t) {
                            h.default.showRewardVideo({
                                success: function success() {
                                    e.game && (e.game.fuhuo(), e.game.sendEvent("videoFuhuo")), e.hide();
                                }
                            }),
                                t.stopPropagation();
                        },
                        this
                    ),
                    this.closeBtn.on(
                        cc.Node.EventType.TOUCH_END,
                        function (e) {
                            t.game.showFailUI(), t.hide(), e.stopPropagation();
                        },
                        this
                    );
            }),
            (e.prototype.moreGame = function () {
                this.game.showMoreGame();
            }),
            (e.prototype.follow = function () {
                this.game.jumpToDy();
            }),
            (e.prototype.hide = function () {
                this.game && (this.game._zanting = !1), p.UIMgr.hide(d.default.FuHuoUI, !1, !0);
            }),
            (e.prototype.init = function (t) {
                this.game = t;
            }),
            (e.prototype.onShow = function () {
                (this.node.active = !0),
                    (this.childNode.scale = 0),
                    cc
                        .tween(this.childNode)
                        .to(0.3, {scale: 1})
                        .call(function () {})
                        .start(),
                    h.default.getRecorderTime() > 2e4 &&
                    h.default.isTT() &&
                    !h.default.getRecorderState() &&
                    u.default.shareVideoCount < 2
                        ? ((this.videoBtn.active = !0), (this.shareBtn.active = !0))
                        : ((this.videoBtn.active = !0), (this.shareBtn.active = !1)),
                    (this.game._zanting = !0);
            }),
            (e.prototype.onEnable = function () {
                h.default.isTT() && h.default.showBanner();
            }),
            (e.prototype.onDisable = function () {
                h.default.isTT() && h.default.hideBanner();
            }),
            (e.prototype.start = function () {}),
            s([a(cc.Node)], e.prototype, "childNode", void 0),
            s([a(cc.Node)], e.prototype, "shareBtn", void 0),
            s([a(cc.Node)], e.prototype, "videoBtn", void 0),
            s([a(cc.Node)], e.prototype, "closeBtn", void 0),
            s([a(cc.Node)], e.prototype, "btnsNode", void 0),
            s([c], e)
        );
    })(l.default);
o.default = f;
